Skip to content

Skip write op in read only #6550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 11, 2025

Conversation

smithellis
Copy link
Contributor

Add @skip_if_read_only_mode to _rebuild_kb_chunk task

Prevents task from executing during read-only operations like document deletion,
avoiding transaction errors.

@smithellis smithellis requested a review from Copilot March 10, 2025 19:51
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR adds a new decorator (@skip_if_read_only_mode) to the _rebuild_kb_chunk task to prevent write operations during read-only operations.

  • Adds the @skip_if_read_only_mode decorator to the _rebuild_kb_chunk task.
  • Helps avoid transaction errors during document deletion.

Reviewed Changes

File Description
kitsune/wiki/tasks.py Added @skip_if_read_only_mode decorator to skip task execution in read-only mode

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

@@ -214,6 +214,7 @@ def rebuild_kb():


@shared_task(rate_limit="5/m")
@skip_if_read_only_mode
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is called by rebuild_kb task which already has the decorator. Maybe that's not the cause of the sentry error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - sorry, I had pulled this back into In Progress status for this very reason. Revision added.

@akatsoulas akatsoulas merged commit 4ce3fd1 into mozilla:main Mar 11, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants